<section class="wrapper">
  <!-- page start-->
  <div class="row">
    <div class="col-lg-12">
      <section class="panel">
        <header class="panel-heading">
          修 改
        </header>
        <div class="panel-body">
          <form class="form-horizontal adminex-form" >
            <div class="form-group">
              <label class="col-sm-2 col-sm-2 control-label"><i class="bi_tian">*&nbsp</i>名称</label>
              <div class="col-sm-10">
                <input type="text" name="name" value="<%= @attachment.name %>" class="form-control" placeholder="名称" disabled>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 col-sm-2 control-label"><i class="bi_tian">*&nbsp</i>状态</label>
              <div class="col-sm-10">
                <select class="form-control" name="status">
                  <option value="1">可用</option>
                  <option value="2" <%= @attachment.status== 2 ? 'selected' : '' %>>停用</option>
                </select>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 col-sm-2 control-label"></label>
              <div class="col-sm-10">
                <button type="button" class="btn btn-primary" id="submit_data" data-url="/admin/attachments/<%= @attachment.id %>">提交</button>
              </div>
            </div>
          </form>
        </div>
      </section>
    </div>
  </div>
  <!-- page end-->
</section>
<% content_for :js do %>
  <script type="text/javascript" charset="utf-8">
      $(function () {
          $('#submit_data').click(function () {
              var data = {};
              var _this = $(this);
              var url = _this.attr('data-url');
              data['status'] = $('select[name=status]').val();
              doRequest(_this,url,'PUT',data);
          });
      });
  </script>
<% end %>